@extends('admin.layout')

@section('title', $title)

@section('content')
	<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                用户管理
                <small>添加</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">用户管理</a></li>
                <li class="active">编辑</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速编辑用户</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/user/update') }}" method="post" enctype="multipart/form-data">
                            <div class="box-body">
                                @if(session('info'))
                                <div id="jg" class="callout callout-info">
                                    <p>{{ session('info') }}</p>
                                </div>
                                @endif
								@if(count($errors) > 0)
									<div id="jg" class="callout callout-info">
										<h4>警告！</h4>
										<ul>
											@foreach($errors -> all() as $error)
												<li>{{ $error }}</li>
											@endforeach
										</ul>
									</div>
								@endif

                                <input type="hidden" name="id" value="{{ $data -> id }}">
								
								{{ csrf_field() }}
                                <div class="form-group">
                                    <label for="exampleInputEmail1">用户名</label>
                                    <input name="user_name" type="text" class="form-control" value="{{ $data -> user_name }}" id="exampleInputName"
                                           placeholder="请输入6-18位的用户名">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">邮箱</label>
                                    <input name="email" type="text" class="form-control" value="{{ $data -> email }}" id="exampleInputEmail1"
                                           placeholder="请输入邮箱">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">头像</label>
                                    <img width="200px" height="200px" src="/uploads/yhtx/{{ $data -> photo }}">
                                    <p class="help-block">请选择您的头像</p>
                                    <input name="photo" type="file" id="exampleInputFile">
                                </div>
								<!-- <div class="form-group">
                                    <label for="exampleInputFile">头像</label>
                                    <p class="help-block">请选择您的头像</p>
                                    <input name="photo" type="file" id="exampleInputFile">
									
                                </div> -->
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">编辑</button>
                                <button type="reset" class="btn btn-default">重置</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
					
                </div><!--/.col (left) -->
                <!-- right column -->
                
                </div><!--/.col (right) -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
	<script type="text/javascript">
		window.onload = function()
		{
			//隐藏警告消息
			setInterval(function()
			{
				$('#jg').fadeOut(1000);
			}, 3000);
		}
	</script>
@endsection